package com.wyf.bt

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import android.widget.TextView

/**
 * Created by Administrator on 2017/10/31.
 */
class IndexAdapter(list :List<Bt>,context:Context) : BaseAdapter() {
    var context:Context
    var list:List<Bt>

    init {
        this.context = context
        this.list = list
    }

    override fun getView(p0: Int, p1: View?, p2: ViewGroup?): View {
       var view = LayoutInflater.from(context).inflate(R.layout.item_list,null)
        view.findViewById<TextView>(R.id.item_bt_name).text = list[p0].name
        view.findViewById<TextView>(R.id.item_bt_size).text = list[p0].size
        return  view

    }

    override fun getItem(p0: Int): Any {
        return p0
    }

    override fun getItemId(p0: Int): Long {
       return  p0.toLong()
    }

    override fun getCount(): Int {
       return list.count()
    }
}